//
//  LHQMusicOnViewController.m
//  Music
//
//  Created by dllo on 16/6/9.
//  Copyright © 2016年 dllo. All rights reserved.
//

#import "LHQMusicOnViewController.h"
#import "LHQPlayerMusicTool.h"
#import "LHQlikeModel.h"
#import "DataBaseHandle.h"
#import "Collection.h"
#import "CollectionCell.h"
#import "ListView.h"
#import "LHQLikeViewController.h"
@interface LHQMusicOnViewController ()<UIAlertViewDelegate,PassValue,AVAudioPlayerDelegate,AVPlayerItemOutputPushDelegate,AVAudioPlayerDelegate>
@property(nonatomic,retain)UILabel      *detailName;
@property(nonatomic,retain)UIImageView  *rotationView;
@property(nonatomic,retain)UIButton     *button;
@property(nonatomic,retain)UIImageView  *backImageView;
@property(nonatomic,retain)NSTimer      *timer;
@property(nonatomic,assign)NSInteger    num;
@property(nonatomic,retain)UIImageView  *huaImageView;
@property(nonatomic,assign)NSInteger    tapNumber;
@property(nonatomic,retain)UIImageView  *backView;
@property(nonatomic,retain)UISlider     *progressSlider;
@property(nonatomic,retain)UILabel      *time1;
@property(nonatomic,retain)UILabel      *time2;
@property(nonatomic,retain)NSTimer      *progressUpdateTimer;
@property(nonatomic,retain)UIImageView  *onList;
@property(nonatomic,retain)UIButton     *orderButton;
@property(nonatomic,retain)UIButton     *downButton;
//UItableView
@property (nonatomic,retain) Collection  *collect;
@property (nonatomic,assign) NSInteger  count;
@property (nonatomic,retain) ListView  *listView;
@property (nonatomic,retain) NSMutableArray  *arr;
@property (nonatomic,assign) NSInteger  orderNum;
@property (nonatomic,assign) NSInteger  i ;
@property (nonatomic,assign) NSInteger  j ;
@end

@implementation LHQMusicOnViewController
- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = [UIColor  whiteColor];
    [self  titleView];
    self.navigationItem.leftItemsSupplementBackButton = NO;
    self.orderNum = 1;
    self.navigationItem.title = self.title;
    self.num = 1;
    self.tapNumber = 0;
    [self  collection];
    [self  look];
    
  [[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(play:) name:@"play" object:nil];
[[NSNotificationCenter defaultCenter] addObserver:self selector:@selector(next:) name:@"end" object:nil];

    
    AVAudioSession *session = [AVAudioSession sharedInstance]; [session setActive:YES error:nil];
    [session setCategory:AVAudioSessionCategoryPlayback error:nil];
     [LHQPlayerMusicTool sharePlay].urlMusic = [[NSUserDefaults standardUserDefaults] objectForKey:@"url"];
  
}
-(void)titleView
{
    self.backView = [[UIImageView alloc] init];
   [_backView  sd_setImageWithURL:[NSURL  URLWithString:self.image] placeholderImage:[UIImage  imageNamed:@"1.jpg"]];
    [self.view addSubview:_backView];
    _backView.frame = self.view.bounds;
    
   UIVisualEffectView *effect = [[UIVisualEffectView alloc] initWithEffect:[UIBlurEffect effectWithStyle:UIBlurEffectStyleLight ]];
    effect.frame = [[UIScreen mainScreen] bounds];
    effect.alpha = 1.0;
    [self.view addSubview:effect];
   
    self.rotationView = [[UIImageView alloc] init];
    self.rotationView.image = [UIImage  imageNamed:@"播放页面1.tiff"];
    self.rotationView.backgroundColor = [UIColor  blackColor];
    self.rotationView.frame = CGRectMake(50, 90, Screenwidth-95, Screenwidth-95);
    self.rotationView.layer.cornerRadius = (Screenwidth-95)/2;
    self.rotationView.layer.masksToBounds = YES;
    [self.view addSubview:self.rotationView];
    
    
    self.backImageView = [[UIImageView alloc] init];
    [self.backImageView  sd_setImageWithURL:[NSURL  URLWithString:self.image] placeholderImage:[UIImage  imageNamed:@"1.jpg"]];
    self.backImageView.center = self.rotationView.center;
    self.backImageView.frame = CGRectMake(45, 45, Screenwidth-185, Screenwidth-185);
    self.backImageView.layer.cornerRadius = (Screenwidth-185)/2;
    self.backImageView.layer.masksToBounds = YES;
    [self.rotationView addSubview:self.backImageView];
    
    
    _orderButton = [UIButton buttonWithType:UIButtonTypeCustom];
    _orderButton.frame = CGRectMake(25, 508, 25, 25);
    
    [_orderButton  setImage:[UIImage  imageNamed:@"随机播放"] forState:UIControlStateNormal];
    _orderButton.userInteractionEnabled = YES;
    [_orderButton setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
    
    [_orderButton addTarget:self action:@selector(playorderButton:) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:_orderButton];
    
    UIButton  *lastButton =[UIButton buttonWithType:UIButtonTypeCustom];
    lastButton.frame = CGRectMake(100.5, 500, 40, 40);
    [lastButton  setImage:[UIImage  imageNamed:@"后退.tiff"] forState:UIControlStateNormal];
    [lastButton  addTarget:self action:@selector(didClickedlastButton:) forControlEvents:UIControlEventTouchUpInside];
    [self.view  addSubview:lastButton];
    
    UIButton  *nextButton =[UIButton buttonWithType:UIButtonTypeCustom];
    nextButton.frame = CGRectMake(234.5, 500, 40, 40);
    [nextButton  setImage:[UIImage  imageNamed:@"前进.tiff"] forState:UIControlStateNormal];
    [nextButton  addTarget:self action:@selector(didClickednextButton:) forControlEvents:UIControlEventTouchUpInside];
    [self.view  addSubview:nextButton];
    
    self.onList = [[UIImageView alloc] init];
    self.onList.image = [[UIImage  imageNamed:@"列表"]imageWithRenderingMode:UIImageRenderingModeAlwaysOriginal];
    self.onList.frame = CGRectMake(325, 508, 25, 25);
    self.onList.userInteractionEnabled = YES;
    [self.view addSubview:self.onList];
    
    UITapGestureRecognizer  *taplist = [[UITapGestureRecognizer  alloc] init];
    [taplist   addTarget:self action:@selector(taplist:)];
    [self.onList  addGestureRecognizer:taplist];
    


    _button = [UIButton buttonWithType:UIButtonTypeCustom];
    _button.frame = CGRectMake(167, 500, 40, 40);
    [_button  setImage:[UIImage  imageNamed:@"中间.tiff"] forState:UIControlStateNormal];
    _button.userInteractionEnabled = YES;
    [_button setTitleColor:[UIColor blackColor] forState:UIControlStateNormal];
    [_button addTarget:self action:@selector(playOrPauseAct:) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:_button];
    
//    UITapGestureRecognizer  *tap = [[UITapGestureRecognizer  alloc] init];
//    [tap   addTarget:self action:@selector(change:)];
//    [self.view  addGestureRecognizer:tap];


    // 控制播放进度的控制条
    self.progressSlider = [[UISlider alloc] initWithFrame:CGRectMake(33.5, 480, 307, 10)];
    _progressSlider.minimumTrackTintColor =[UIColor colorWithRed:1.00 green:0.00 blue:0.00 alpha:1.00];
    [_progressSlider  setThumbImage:[UIImage  imageNamed:@"点.tiff"] forState:UIControlStateNormal];
    _progressSlider.userInteractionEnabled = YES;
    [_progressSlider addTarget:self action:@selector(progressSliderAction:) forControlEvents:UIControlEventValueChanged];
    [self.view addSubview:self.progressSlider];
    
    // 播放进度时间
    self.time1 = [[UILabel alloc] initWithFrame:CGRectMake(5, 480, 60.5, 10)];
    self.time1.font = [UIFont systemFontOfSize:10];
    self.time1.text = @"00:00";
    [self.view addSubview:self.time1];
    
    
    self.time2 = [[UILabel alloc] initWithFrame:CGRectMake(self.progressSlider.frame.origin.x+self.progressSlider.frame.size.width, 480, 60.5, 10)];
    self.time2.font = [UIFont systemFontOfSize:10];
    
    //转化时间
    
    NSString *time = self.time;
    NSInteger num = [time integerValue]/1000;
    NSDateFormatter *formatter = [[NSDateFormatter alloc]init];
    [formatter setDateStyle:NSDateFormatterMediumStyle];
    [formatter setTimeStyle:NSDateFormatterShortStyle];
    [formatter setDateFormat:@"mm:ss"];
    NSDate*confromTimesp = [NSDate dateWithTimeIntervalSince1970:num];
    NSString *confromTimespStr = [formatter stringFromDate:confromTimesp];
    self.time2.text = confromTimespStr;
    [self.view addSubview:self.time2];
    
   //上拉listview
    //菜单列表视图的初始化:
    self.listView = [[ListView alloc] initWithFrame:CGRectMake(0, Screenheight, Screenwidth, Screenheight - 150)];
    self.listView.delegate = self;
    self.listView.backgroundColor = [UIColor whiteColor];
    [self.view addSubview:_listView];
    
    
    
}
//协议方法
-(void)passString:(NSString *)title Singname:(NSString *)singname image:(NSString *)image time:(NSString *)time url:(NSString *)url  arr:(NSArray *)arr
{
    LHQMusicOnViewController   *detail = [[LHQMusicOnViewController alloc] init];
    detail.urlid = singname;
    detail.title = title;
    detail.time = time;
    detail.image = image;
    detail.url = url;
    detail.DataSource = arr.mutableCopy;
    UIBarButtonItem *item = [[UIBarButtonItem alloc] initWithTitle:@"返回" style:UIBarButtonItemStylePlain target:nil action:nil];
    self.navigationItem.backBarButtonItem = item;
    [self.navigationController  pushViewController:detail animated:NO];
}
//播放列表手势
-(void)taplist:(UITapGestureRecognizer *)list
{
    
       //视图的展开和收起:
        //打开ListView:
        [UIView animateWithDuration:0.5 animations:^{
            self.listView.frame = CGRectMake(0,150, Screenwidth, Screenheight );
        }];
       //tabBar隐藏:
        self.navigationController.tabBarController.tabBar.hidden = YES;
        
   //添加进入数据库
    [[DataBaseHandle  shareDataBaseHandle]open];
    Collection  *collect = [[Collection  alloc] init];
    collect.title = self.title;
    collect.urlid = self.urlid;
    collect.image = self.image;
    collect.time = self.time ;
    collect.url = self.url;
    [[DataBaseHandle  shareDataBaseHandle]createTable];
    if (self.count == 1) {
        [[DataBaseHandle  shareDataBaseHandle]deleteCollect:self.title];
        self.count = 0;
        
    }else{
        [[DataBaseHandle  shareDataBaseHandle]insertCollect:collect];
        self.count = 1;
    }
    [[DataBaseHandle  shareDataBaseHandle]close];
   
}
//判断数据库有没有收藏的方法
-(void)collection
{
    [[DataBaseHandle  shareDataBaseHandle]open];
    NSArray  *arr = [NSArray  array];
    arr  =  [[DataBaseHandle  shareDataBaseHandle]selectCollect];
    for (Collection *collect in arr) {
        if ([collect.title isEqualToString:self.title]
            ) {
            self.count = 1;
            break;
        }else{
            self.count = 0;
        }
    }
    
    [[DataBaseHandle  shareDataBaseHandle]close];
    
}

//收起列表
-(void)pass
{
    //收起listView:
    [UIView animateWithDuration:0.5 animations:^{
        self.listView.frame = CGRectMake(0, Screenheight,Screenwidth, 0);
        
    } completion:^(BOOL finished) {
    }];

}
//播放顺序
-(void)playorderButton:(UIButton *)order
{
    //列表循环
    [order  removeTarget:self action:@selector(playorderButton:) forControlEvents:UIControlEventTouchUpInside];
    [order  setImage:[UIImage  imageNamed:@"列表循环"] forState:UIControlStateNormal];
    [order  addTarget:self action:@selector(Didxunhuan:) forControlEvents:UIControlEventTouchUpInside];
    UILabel *shareLabel = [[UILabel alloc] initWithFrame:CGRectMake(130, -40, 100, 40)];
    [self.view addSubview:shareLabel];
    [UILabel animateWithDuration:1 animations:^{
        shareLabel.frame = CGRectMake(130, 230, 100, 40);
        shareLabel.text = @"列表循环";
        shareLabel.textAlignment = NSTextAlignmentCenter;
        shareLabel.textColor = [UIColor whiteColor];
    }];
    [UILabel animateWithDuration:1 animations:^{
        [UILabel setAnimationDelay:0.5];
        shareLabel.frame = CGRectMake(130, -40, 100, 40);
    }];
    self.orderNum = 1;
}
//单曲循环
-(void)Didxunhuan:(UIButton *)order
{
    
    [order  removeTarget:self action:@selector(Didxunhuan:) forControlEvents:UIControlEventTouchUpInside];
    [order  setImage:[UIImage  imageNamed:@"单曲循环"] forState:UIControlStateNormal];
    [order  addTarget:self action:@selector(Didsuiji:) forControlEvents:UIControlEventTouchUpInside];
    UILabel *shareLabel = [[UILabel alloc] initWithFrame:CGRectMake(130, -40, 100, 40)];
    [self.view addSubview:shareLabel];
    [UILabel animateWithDuration:1 animations:^{
        shareLabel.frame = CGRectMake(130, 230, 100, 40);
        shareLabel.text = @"单曲循环";
        shareLabel.textAlignment = NSTextAlignmentCenter;
        shareLabel.textColor = [UIColor whiteColor];
    }];
    [UILabel animateWithDuration:1 animations:^{
        [UILabel setAnimationDelay:0.5];
        shareLabel.frame = CGRectMake(130, -40, 100, 40);
    }];
    
    self.orderNum = 2;
}
//随机播放
-(void)Didsuiji:(UIButton *)order
{
    [order  removeTarget:self action:@selector(Didsuiji:) forControlEvents:UIControlEventTouchUpInside];
    [order  setImage:[UIImage  imageNamed:@"随机播放"] forState:UIControlStateNormal];
    [order  addTarget:self action:@selector(playorderButton:) forControlEvents:UIControlEventTouchUpInside];
    
    UILabel *shareLabel = [[UILabel alloc] initWithFrame:CGRectMake(130, -40, 100, 40)];
    [self.view addSubview:shareLabel];
    [UILabel animateWithDuration:1 animations:^{
        shareLabel.frame = CGRectMake(130, 230, 100, 40);
        shareLabel.text = @"随机播放";
        shareLabel.textAlignment = NSTextAlignmentCenter;
        shareLabel.textColor = [UIColor whiteColor];
    }];
    [UILabel animateWithDuration:1 animations:^{
        [UILabel setAnimationDelay:0.5];
        shareLabel.frame = CGRectMake(130, -40, 100, 40);
    }];
    self.orderNum = 3;

}
//滑块变化
-(void)sliderTime
{
    LHQPlayerMusicTool  *share = [LHQPlayerMusicTool  sharePlay];
    self.progressSlider.value = CMTimeGetSeconds(share.player.currentItem.currentTime) / CMTimeGetSeconds(share.player.currentItem.duration);
    if (share.player.currentItem ) {
    CMTime ctime = share.player.currentTime;
    UInt64 currentTimeSec = ctime.value/ctime.timescale;
    NSString  *url =[NSString  stringWithFormat:@"%llu",currentTimeSec];
    ;
    int  num = [url  intValue];
    int  min = 0;
    int  sec = 0;
    sec = sec +1;
    sec = num % 60;
    min = num / 60;
    NSMutableString *temp1 = [NSMutableString stringWithFormat:@"0%d", min];
    NSString *temp2 = [NSString string];
    if (sec >= 10) {
    temp2 = [NSString stringWithFormat:@"%d", sec];
    }else{
    temp2 = [NSString stringWithFormat:@"0%d", sec];
        }
    [temp1 appendString:@":"];
    [temp1 appendString:temp2];
    self.time1.text = temp1;
    }
    
}
//slider
- (void)progressSliderAction:(UISlider *)sender {
        
    
    LHQPlayerMusicTool  *share = [LHQPlayerMusicTool  sharePlay];
    self.progressSlider.value = CMTimeGetSeconds(share.player.currentItem.currentTime) / CMTimeGetSeconds(share.player.currentItem.duration);
    //设置拖拽进度的X的值
    //CMTimeGetSeconds(share.player.currentItem.currentTime)/ CMTimeGetSeconds(share.player.currentItem.duration);
   
    //share.player.currentItem.currentTime/share.player.currentItem.duration = sender.value;
         //4.如果开始拖动，那么就停止定时器
    if (sender.state==UIGestureRecognizerStateBegan) {
        //停止定时器
        [self.timer invalidate];
        [_progressUpdateTimer  invalidate];
      
        
    }else if(sender.state==UIGestureRecognizerStateEnded)
    {
        _timer = [NSTimer scheduledTimerWithTimeInterval:0 target:self selector:@selector(rotation) userInfo:nil repeats:YES];
        [self.button  setImage:[UIImage  imageNamed:@"中间关.tiff"] forState:UIControlStateNormal];
        self.progressUpdateTimer =[NSTimer  scheduledTimerWithTimeInterval:0 target:self selector:@selector(sliderTime) userInfo:nil repeats:YES];
    }

}

//手势方法
-(void)change:(UITapGestureRecognizer *)tap
{
    
}
-(void)look
{
    
    if (self.num == 1 ) {
        _timer = [NSTimer scheduledTimerWithTimeInterval:0 target:self selector:@selector(rotation) userInfo:nil repeats:YES];
        [self.button  setImage:[UIImage  imageNamed:@"中间关.tiff"] forState:UIControlStateNormal];
        self.progressUpdateTimer =[NSTimer  scheduledTimerWithTimeInterval:0 target:self selector:@selector(sliderTime) userInfo:nil repeats:YES];
        //播放音乐
       [LHQPlayerMusicTool getPlay:self.url];
       [LHQPlayerMusicTool sharePlay].urlMusic = self.url;
        self.num = 0;
        
    }
    else{
        [_timer  invalidate];
        _timer = nil;
        [_progressUpdateTimer  invalidate ];
        _progressUpdateTimer = nil;
        [[LHQPlayerMusicTool sharePlay].player  pause];
        [_button  setImage:[UIImage  imageNamed:@"中间.tiff"] forState:UIControlStateNormal];
        self.num = 1;
    }
}
//播放暂停按钮
-(void)playOrPauseAct:(UIButton  *)button{
   
   
    if (![LHQPlayerMusicTool sharePlay].isplay) {
      LHQlikeModel   *model =[self.DataSource  objectAtIndex:_index];
       _timer = [NSTimer scheduledTimerWithTimeInterval:0 target:self selector:@selector(rotation) userInfo:nil repeats:YES];
        [self.button  setImage:[UIImage  imageNamed:@"中间关.tiff"] forState:UIControlStateNormal];
         self.progressUpdateTimer =[NSTimer  scheduledTimerWithTimeInterval:0 target:self selector:@selector(sliderTime) userInfo:nil repeats:YES];
       [[NSRunLoop mainRunLoop]addTimer:self.timer forMode:NSRunLoopCommonModes];
       //播放音乐
        NSString  *url = model.urlList[1][@"url"];
       [LHQPlayerMusicTool getPlay:url];
        [LHQPlayerMusicTool sharePlay].urlMusic = url;
      if([[NSUserDefaults standardUserDefaults] boolForKey:@"isLocal"]){
            //播放音乐
            [LHQPlayerMusicTool  getPlay:[LHQPlayerMusicTool sharePlay].urlMusic];
            [[NSUserDefaults standardUserDefaults] setBool:NO forKey:@"isLocal"];
        }else{
            [[LHQPlayerMusicTool sharePlay].player play];
        }

    }
    else{
        [_timer  invalidate];
        _timer = nil;
        [_progressUpdateTimer  invalidate ];
        _progressUpdateTimer = nil;
       [_button  setImage:[UIImage  imageNamed:@"中间.tiff"] forState:UIControlStateNormal];
       [[LHQPlayerMusicTool sharePlay].player pause];
       }
   [LHQPlayerMusicTool sharePlay].isplay = ![LHQPlayerMusicTool sharePlay].isplay;


}
//旋转
- (void)rotation
{
    _rotationView.transform = CGAffineTransformRotate(_rotationView.transform, 3.14 / 350);
}
//下一曲
-(void)didClickednextButton:(UIButton *)next
{
    if (self.index== self.DataSource.count - 1) {
        self.index = 0 - 1 ;
    }
    self.index++;
   LHQlikeModel   *model =[self.DataSource  objectAtIndex:_index];
   self.navigationItem.title = model.name;
    self.time = model.auditionList[1][@"duration"];
    NSString *time = self.time;
    NSInteger num = [time integerValue]/1000;
    NSDateFormatter *formatter = [[NSDateFormatter alloc]init];
    [formatter setDateStyle:NSDateFormatterMediumStyle];
    [formatter setTimeStyle:NSDateFormatterShortStyle];
    [formatter setDateFormat:@"mm:ss"];
    NSDate*confromTimesp = [NSDate dateWithTimeIntervalSince1970:num];
    NSString *confromTimespStr = [formatter stringFromDate:confromTimesp];
    self.time2.text = confromTimespStr;

    NSString  *url = model.urlList[1][@"url"];
    [self.backImageView  sd_setImageWithURL:[NSURL  URLWithString:model.picUrl] placeholderImage:[UIImage  imageNamed:@"1.jpg"]];
    [_backView  sd_setImageWithURL:[NSURL  URLWithString:model.picUrl] placeholderImage:[UIImage  imageNamed:@"1.jpg"]];
    [LHQPlayerMusicTool getPlay:url];
    [LHQPlayerMusicTool sharePlay].urlMusic = url;
   
    

}
//上一曲
-(void)didClickedlastButton:(UIButton *)next
{
    if (self.index== 0) {
        self.index = self.DataSource.count ;
    }
    self.index--;
    LHQlikeModel   *model =[self.DataSource  objectAtIndex:_index];
    self.navigationItem.title = model.name;
    self.time = model.auditionList[1][@"duration"];
    NSString *time = self.time;
    NSInteger num = [time integerValue]/1000;
    NSDateFormatter *formatter = [[NSDateFormatter alloc]init];
    [formatter setDateStyle:NSDateFormatterMediumStyle];
    [formatter setTimeStyle:NSDateFormatterShortStyle];
    [formatter setDateFormat:@"mm:ss"];
    NSDate*confromTimesp = [NSDate dateWithTimeIntervalSince1970:num];
    NSString *confromTimespStr = [formatter stringFromDate:confromTimesp];
    self.time2.text = confromTimespStr;

    NSString  *url = model.urlList[1][@"url"];
    [self.backImageView  sd_setImageWithURL:[NSURL  URLWithString:model.picUrl] placeholderImage:[UIImage  imageNamed:@"1.jpg"]];
    [_backView  sd_setImageWithURL:[NSURL  URLWithString:model.picUrl] placeholderImage:[UIImage  imageNamed:@"1.jpg"]];
    [LHQPlayerMusicTool getPlay:url];
    [LHQPlayerMusicTool sharePlay].urlMusic = url;
}
-(void)play:(NSNotification *)not{
    self.title = not.userInfo[@"name"];
    self.urlid = not.userInfo[@"nameSinge"];
    self.time = not.userInfo[@"time"];
    NSString *time = self.time;
    NSInteger num = [time integerValue]/1000;
    NSDateFormatter *formatter = [[NSDateFormatter alloc]init];
    [formatter setDateStyle:NSDateFormatterMediumStyle];
    [formatter setTimeStyle:NSDateFormatterShortStyle];
    [formatter setDateFormat:@"mm:ss"];
    NSDate*confromTimesp = [NSDate dateWithTimeIntervalSince1970:num];
    NSString *confromTimespStr = [formatter stringFromDate:confromTimesp];
    self.time2.text = confromTimespStr;
    self.url = not.userInfo[@"url"];
    self.image = not.userInfo[@"image"];
    [self.backImageView  sd_setImageWithURL:[NSURL  URLWithString:self.image] placeholderImage:[UIImage  imageNamed:@"1.jpg"]];
    [_backView  sd_setImageWithURL:[NSURL  URLWithString:self.image] placeholderImage:[UIImage  imageNamed:@"1.jpg"]];
    
}
- (void)next:(UIButton *)bu{
    
    _index+=1;
    LHQlikeModel   *model =[self.DataSource  objectAtIndex:_index];
    
    NSDictionary *dic = [NSDictionary dictionaryWithObjectsAndKeys:model.name,@"name",model.singerName,@"nameSinge",model.picUrl,@"image",model.urlList[1][@"url"],@"url",model.auditionList[1][@"duration"],@"time",nil];
        [[NSNotificationCenter defaultCenter] postNotificationName:@"play" object:self userInfo:dic];
        
        [LHQPlayerMusicTool getPlay:model.auditionList[0][@"url"]];
        
        
        [LHQPlayerMusicTool sharePlay].urlMusic = model.auditionList[0][@"url"];
}
- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
